#%RAML 1.0 Library
uses:
  constraint: constraint.raml
  container: podContainer.raml
  env: environmentVariable.raml
  label: label.raml
  net: network.raml
  pragma: pragma.raml
  resources: resources.raml
  strings: stringTypes.raml
  secrets: secrets.raml
  volumes: volumes.raml
  unreachableStrategy: unreachableStrategy.raml
  killSelection: killSelection.raml
types:
  PodScalingPolicyType:
    type: string
    enum: [ fixed ]
  PodScalingPolicy:
    discriminator: kind
    description: |
      Add new possible super-types as different scaling policies are supported.
    properties:
      kind: PodScalingPolicyType
  FixedPodScalingPolicy:
    type: PodScalingPolicy
    discriminatorValue: fixed
    properties:
      instances:
        type: integer
        format: int32
        description: The number of instances of this pod to start.
        minimum: 0
        default: 1
  PodSchedulingBackoffStrategy:
    type: object
    description: |
      Configures exponential backoff behavior when launching potentially sick apps.
      This prevents sandboxes associated with consecutively failing tasks from filling up the hard disk on Mesos slaves.
      The backoff period is multiplied by the factor for each consecutive failure until it reaches maxLaunchDelaySeconds.
      This applies also to tasks that are killed due to failing too many health checks.
    properties:
      backoff?:
        type: number
        description: The initial backoff (seconds) applied when a launched instance fails.
        default: 1
        minimum: 0
      backoffFactor?:
        type: number
        description: The factor applied to the current backoff to determine the new backoff.
        default: 1.15
        minimum: 0
      maxLaunchDelay?:
        type: number
        description: The maximum backoff (seconds) applied when subsequent failures are detected.
        minimum: 0
        default: 3600
  PodUpgradeStrategy:
    type: object
    description: |
      During an upgrade all instances of an application get replaced by a new version.
      The upgradeStrategy controls how Marathon stops old versions and launches new versions.
    properties:
      minimumHealthCapacity?:
        type: number
        description: |
          A number between 0and 1 that is multiplied with the instance count.
          This is the minimum number of healthy nodes that do not sacrifice overall application purpose.
          Marathon will make sure, during the upgrade process, that at any point of time this number of healthy instances are up.
        default: 1
        minimum: 0
        maximum: 1
      maximumOverCapacity?:
        type: number
        description: |
          A number between 0 and 1 which is multiplied with the instance count.
          This is the maximum number of additional instances launched at any point of time during the upgrade process.
        default: 1
        minimum: 0
        maximum: 1
  PodPlacementPolicy:
    type: object
    properties:
      constraints?:
        type: constraint.Constraint[]
        (pragma.omitEmpty):
        uniqueItems: true
      acceptedResourceRoles?:
        type: string[]
        (pragma.omitEmpty):
        example: [public-facing]
        description: |
          A list of resource roles.
          Marathon considers only resource offers with roles in this list for
          launching tasks of this app. If you do not specify this,
          Marathon considers all resource offers with roles that have been
          configured by the `--default_accepted_resource_roles` command line flag.
          If no `--default_accepted_resource_roles` was given on startup,
          Marathon considers all resource offers. To register Marathon for a role,
          you need to specify the `--mesos_role` command line flag on startup.
          If you want to assign all resources of a slave to a role,
          you can use the `--default_role` argument when starting up the slave.
          If you need a more fine-grained configuration, you can use the
          `--resources` argument to specify resource shares per role.
          See [the Mesos attribute and resources documentation](http://mesos.apache.org/documentation/latest/attributes-resources/) for details
  PodSchedulingPolicy:
    type: object
    properties:
      backoff?: PodSchedulingBackoffStrategy
      upgrade?: PodUpgradeStrategy
      placement?:
        type: PodPlacementPolicy
        (pragma.omitEmpty):
      killSelection?: killSelection.KillSelection
      unreachableStrategy?: unreachableStrategy.UnreachableStrategy
  Pod:
    description: |
      A pod allows one to launch a collection co-located (on the same agent) containers
      that share the same network namespace and that may share the same volumes.
      Resources are specified on a per-container basis.
    properties:
      id: strings.PathId
      labels?:
        type: label.KVLabels
        (pragma.omitEmpty):
        description: |
          Metadata as key/value pair.
          Useful when passing directives to be interpreted by Mesos modules.
      version?:
        type: datetime
        description: The version of the definition, immutable
      user?:
        type: string
        description: |
          The OS user to use to run the tasks on the agent.
          May be overridden by a container.
      environment?:
        type: env.EnvVars
        (pragma.omitEmpty):
        description: |
          Environment Variables to set at the pod level.
          Individual containers may override them
      containers:
        type: array
        items: container.PodContainer
        minItems: 1
      secrets?:
        type: secrets.Secrets
        (pragma.omitEmpty):
      volumes?:
        type: volumes.Volume[]
        (pragma.omitEmpty):
        description: Volumes defined on a pod level that are mounted into containers
      networks?:
        type: net.Network[]
        (pragma.omitEmpty):
        description: |
          Network settings are defined on a pod level. All containers share the same network stack.
          At this time, only one stack is supported.
      scaling?: PodScalingPolicy
      scheduling?: PodSchedulingPolicy
      executorResources?:
          type: resources.ExecutorResources
          description: The resources to allocate to the executor.
